<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:c="http://java.sun.com/jsp/jstl/core"
       xmlns:sec="http://www.springframework.org/security/tags">
  
    <h:head>
        <title>Noticia</title>
        <style>
           body {
                width: 960px;
                margin: 40px auto;
                height:100%;
                font-size:14px;
                color:black;
                font-family:Arial, Helvetica, sans-serif;
                background-color: #708090;
            }
        </style>

    </h:head>
    <h:body>

        <p:growl showDetail="true" autoUpdate="true" id="delu" /> 


        <ui:repeat  value="#{noticiaControlador.noticias}" var="noticia" >
            <p:panel header="#{noticia.titulo}">
                        <h:outputText value="#{noticia.contenido}" escape="true" /> 

                        <sec:authorize access="hasRole('ROLE_ADMIN')">
                        <h:form>
                     <p:commandButton value="#{msg.borrar}"  action="irborrarNoty" ajax="false" update="delu" >
                        <f:setPropertyActionListener value="#{noticia}"  target="#{noticiaControlador.noticia}" />
                    </p:commandButton>
                            </h:form>
                            </sec:authorize>
              </p:panel>
            
           
                 
            
        </ui:repeat>
        
          <h:outputText value="no hay noticias" rendered="#{empty noticiaControlador.noticias }"/>

        
        <h:outputLink value="/index.html">#{msg.inicio}</h:outputLink>

    </h:body>
</html>

